package com.sdkx.wear_os.adapter

import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.DataBindingHolder
import com.sdkx.wear_os.R
import com.sdkx.wear_os.bean.MineBean
import com.sdkx.wear_os.databinding.LayoutMainItemBinding
import com.sdkx.wear_os.databinding.LayoutMineItemBinding

/**
 * 首页
 */
class MainAdapter : BaseQuickAdapter<MineBean, DataBindingHolder<LayoutMainItemBinding>>() {
    override fun onBindViewHolder(
        holder: DataBindingHolder<LayoutMainItemBinding>,
        position: Int,
        item: MineBean?
    ) {
        holder.binding.run {
            item?.let { item ->
                mainItemIv.setImageResource(R.color.black)
                mainItemTitle.text = item.title
            }
        }
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): DataBindingHolder<LayoutMainItemBinding> {
        return DataBindingHolder<LayoutMainItemBinding>(R.layout.layout_main_item, parent)
    }
}